package com.bh.service.impl;

import com.bh.mapper.RoleMapper;
import com.bh.pojo.entry.Role;
import com.bh.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<Role> findById(Integer uid) {

        return roleMapper.findById(uid);
    }

    @Override
    public List<Role> findAll(String likename) {

        return roleMapper.findAll(likename);
    }

    @Override
    public void allocationMenu(Integer rid, List<Integer> mids) {
        //删除角色的菜单信息
        roleMapper.deleteRMById(rid);
        //重新给角色分配菜单信息
        roleMapper.addRM(rid,mids);
    }
}
